package com.wnxy.consumer.b_ps;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class SeatConsumer {

    private final String QUEUE_FANOUT_SEAT = "queue-fanout-seat";
    private final String EXCHANGE_FANOUT = "exchange-fanout";

    // 通过交换机的类型是fanout，指定消息模型是发布订阅
    @RabbitListener(bindings = {@QueueBinding(
            value = @Queue(name = QUEUE_FANOUT_SEAT,durable = "true"),
            exchange = @Exchange(name = EXCHANGE_FANOUT,type = ExchangeTypes.FANOUT)
    )})
    public void handlerSeat(String message) {
        System.out.println("消费者锁定座位：" + message);
    }
}
